$(document).ready(function() {
	initialize1();
//retornar(row1,row2);
});
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;
function initialize1() {
	directionsDisplay = new google.maps.DirectionsRenderer();
	var chicago = new google.maps.LatLng(41.669, 1.516);
	var myOptions = {
		zoom : 10,
		mapTypeId : google.maps.MapTypeId.ROADMAP,
		center : chicago
	}
	map = new google.maps.Map(document.getElementById("map_recorregut"), myOptions);
	retornar();

}
//envia dades a php per mostra recorregut del viatge seleccionat
function retornar() {//FA LA CRIDA CAP AL PHP
calcRoute(row1,row2);

}

//calcula la ruta que del viatge seleccionat els textbox
function calcRoute(origen, desti) {
	var request = {
		origin : origen,
		destination : desti,
		travelMode : google.maps.DirectionsTravelMode.DRIVING
	};
	directionsService.route(request, function(response, status) {
		if(status == google.maps.DirectionsStatus.OK) {
			directionsDisplay.setDirections(response);
			directionsDisplay.setMap(map);
			
		}
	});

}
